package com.biostime.dingdingbox.modules.db.service;

import java.util.Date;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.biostime.dingdingbox.common.service.CrudService;
import com.biostime.dingdingbox.modules.db.dao.VideoRecordDao;
import com.biostime.dingdingbox.modules.db.entity.VideoRecord;

/**
 * 视频记录表Service
 * @author chenweicheng
 * @version 2016-07-01
 */
@Service
public class VideoRecordService extends CrudService<VideoRecordDao, VideoRecord> {
	
	@Override
	@Transactional(readOnly = false)
	public void save(VideoRecord entity) {
		if (entity.getIsNewRecord()){
			entity.preInsert();
			entity.setCreateDate(new Date());
			dao.insert(entity);
		}else{
			entity.preUpdate();
			dao.update(entity);
		}
	}
	
}
